﻿def calc_1_month(principal):
   mon_inter_rate = 0.0235 / 12
   return principal + principal * mon_inter_rate

def calc_benefits(principal, months):
   for i in range(months):
      principal = calc_1_month(principal)
   return principal

tatal_months = 30 * 12
first_principal = 3000
total_principal = 0
decreas_month = 0    # 2.64
principal_list = []
for i in range(tatal_months):
   principal_list.append(first_principal)
   total_principal += first_principal
   first_principal -= decreas_month

print(f"每月还的本金: {principal_list}")

months = tatal_months
total_vevenue = 0
monthNum = 1
for principal in principal_list:
   month_total_vevenue = calc_benefits(principal, months)
   print(f"第{monthNum}月，本金：{principal}, 存月数：{months}, 按月复利计算总收益：{month_total_vevenue}")
   total_vevenue += month_total_vevenue
   monthNum += 1
   months -= 1

print(f"最后总金额：{total_vevenue}, 总本金：{total_principal}, 总收益: {total_vevenue - total_principal}")
